﻿<script type="text/javascript">
    function SelectPageUrl() {
        var url = CPWebRootPath + "/Plat/Tab/TabView?TabCode=Tab201806080553580010";
        var nHeight = 650;
        var nWidth = 900;
        var iTop = (window.screen.availHeight - 30 - nHeight) / 2;       //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth - 10 - nWidth) / 2;           //获得窗口的水平位置;
        var name = "新窗口_" + Math.random();

        //IE9下面不能加name
        window.open(url, '', "height=" + nHeight + ", width=" + nWidth + ",top=" + iTop + ",left=" + iLeft + ", location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); //写成一行

    }
    function SelectPageUrl_SetReturn(pageUrl) {
        // /Plat/Form/FormView?FormCode=Form201711260656400032&SceneCode=Scene201711260656560034&ViewCode=View201711260656560035
        //&DeviceType=1 & InitGroupCode=Group201711260659240027 & PhaseId=1097 & PKValues=3014
        var sPageUrl = pageUrl.toLowerCase();
        if (sPageUrl.indexOf("plat/form/formview") == -1) {
            CPFormGlobal_Scope.SetFieldValue("Flow_TemplatePhaseForm", "FormPageUrl", 0, pageUrl);
        }
        else {
            var tmpArray = pageUrl.split('?');
            var array2 = tmpArray[1].split('&');
            var FormCode = "";
            for (var i = 0; i < array2.length; i++) {
                var dA = array2[i].split('=');
                if (dA[0].toLowerCase() == "formcode") {
                    FormCode = dA[1];
                }
            }
            if (FormCode != "") {
                CPFormGlobal_Scope.SetFieldValue("Flow_TemplatePhaseForm", "FormCode", 0, FormCode);
            }
            CPFormGlobal_Scope.SetFieldValue("Flow_TemplatePhaseForm", "FormPageUrl", 0, pageUrl);
        } 
       
    } 
</script>



<script type="text/javascript">
    function ReturnUrl(pageUrl) {
        parent.window.opener.SelectPageUrl_SetReturn(pageUrl);
        parent.window.close();
    }
</script>